]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/entry: Fix primary/secondary icon leak
authorSebastian Keller <skeller@gnome.org>
Sat, 28 Feb 2026 21:26:15 +0000 (22:26 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Mar 2026 17:39:38 +0000 (18:39 +0100)
_st_entry_set_icon() takes a ref when setting the primary/secondary
icon, but the ref is not removed when unsetting the icon or the entry is
destroyed.

Since clutter_actor_add_child() already adds a ref to the icon, there is
actually no need to manually add another ref. So stop doing that to fix
this leak.

This however also requires that StPasswordEntry takes ownership of its
own icon that it may set or unset multiple times. Since it is initially
floating we need to sink the ref for that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4095>
(cherry picked from commit a3c6383d7428f951394a715341cd9ecac4172b7b)

src/st/st-entry.c
src/st/st-password-entry.c

index e3a4b537f7a2c19bf7f6ce65899ca900c0fde51b..963cb5a4a3e72b91a8fe7bb015a29b8c581ab2d5 100644 (file)
@@ -1369,7 +1369,7 @@ _st_entry_set_icon (StEntry       *entry,
     {
       ClutterAction *click_gesture;
 
-      *icon = g_object_ref (new_icon);
+      *icon = new_icon;
 
       clutter_actor_set_reactive (*icon, TRUE);
       clutter_actor_add_child (CLUTTER_ACTOR (entry), *icon);
index 8c6204f37bd56e53356a05453dddcefbeb477701..df51b9fe39a980fc3eb1a81312cdebde6ee21c75 100644 (file)
@@ -224,6 +224,7 @@ st_password_entry_init (StPasswordEntry *entry)
                                            "style-class", "peek-password",
                                            "icon-name", "view-reveal-symbolic",
                                            NULL);
+  g_object_ref_sink (priv->peek_password_icon);
   st_entry_set_secondary_icon (ST_ENTRY (entry), priv->peek_password_icon);
 
   st_password_entry_set_show_peek_icon (entry, TRUE);